package com.kws.tool.config;

import com.kws.tool.util.HttpUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author :yxy
 * @date : 2024/10/29
 */
public class AliIdCardReturnAddress {
    public static String getResult(String idCardNo,String name) throws IOException {
        String host = "https://jmidcardv1.market.alicloudapi.com";
        String path = "/idcard/validate";
        String method = "POST";
        String appcode = "自己的appcode";
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization", "APPCODE " + appcode);
        Map<String, String> querys = new HashMap<String, String>();
        Map<String, String> bodys = new HashMap<String, String>();
        bodys.put("idCardNo", idCardNo);
        bodys.put("name", name);
        HttpResponse response =null;
        try {
            response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return EntityUtils.toString(response.getEntity());
    }
}
